package com.ihr360.expr.operator;

import com.ihr360.expr.ExprException;
import com.ihr360.expr.context.IEvaluationContext;
import com.ihr360.expr.core.AbstractComparisonOperator;
import com.ihr360.expr.core.Expr;
import com.ihr360.expr.core.ExprType;

public class ExprNotEqual extends AbstractComparisonOperator
{
    public ExprNotEqual(Expr lhs, Expr rhs) {
        super(ExprType.NotEqual, lhs, rhs);
    }

    @Override
    public Expr evaluate(IEvaluationContext context) throws ExprException {
        return bool(compare(context) != 0);
    }

    @Override
    public String toString() {
        return lhs + "!=" + rhs;
    }
}